﻿namespace CatClient.Message.Internals
{
    using CatClient.Message;
    using System;
    using System.Collections.Generic;

    public class NullMessage : ITransaction, IMessage, IEvent, IMetric, ITrace, IHeartbeat, ITaggedTransaction, IForkedTransaction, IAsyncForkedTransaction
    {
        private static readonly NullMessage _nullMessage = new NullMessage();

        public ITransaction AddChild(IMessage message) => 
            null;

        public void AddData(string keyValuePairs)
        {
        }

        public void AddData(string key, object value)
        {
        }

        public void Bind(string tag, string childMessageId, string title)
        {
        }

        public void Complete()
        {
        }

        public void Fork()
        {
        }

        public void FreeSecondKey()
        {
        }

        public bool HasChildren() => 
            false;

        public bool IsCompleted() => 
            true;

        public bool IsSuccess() => 
            true;

        public void SetStatus(Exception e)
        {
        }

        public void Start()
        {
        }

        public static ITransaction TRANSACTION =>
            _nullMessage;

        public static IEvent EVENT =>
            _nullMessage;

        public static IMetric METRIC =>
            _nullMessage;

        public static ITrace TRACE =>
            _nullMessage;

        public static IHeartbeat HEARTBEAT =>
            _nullMessage;

        public static ITaggedTransaction TAGGEDTRANSACTION =>
            _nullMessage;

        public static IForkedTransaction FORKEDTRANSACTION =>
            _nullMessage;

        public static IAsyncForkedTransaction ASYNCFORKEDTRANSACTION =>
            _nullMessage;

        public string ContextKey =>
            string.Empty;

        public IList<IMessage> Children =>
            new List<IMessage>();

        public string Data =>
            string.Empty;

        public long DurationInMicros
        {
            get => 
                0L;
            set
            {
            }
        }

        public long DurationInMillis
        {
            get => 
                0L;
            set
            {
            }
        }

        public string Name =>
            string.Empty;

        public string ParentMessageId =>
            string.Empty;

        public string RootMessageId =>
            string.Empty;

        public bool Standalone
        {
            get => 
                true;
            set
            {
            }
        }

        public string Status
        {
            get => 
                string.Empty;
            set
            {
            }
        }

        public string Tag =>
            string.Empty;

        public long Timestamp
        {
            get => 
                0L;
            set
            {
            }
        }

        public string Type =>
            string.Empty;

        public string ForkedMessageId =>
            string.Empty;
    }
}

